package com.cy.teducommunitys.com.cy.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cy.teducommunitys.com.common.vo.JsonResult;
import com.cy.teducommunitys.com.cy.entity.Attention;
import com.cy.teducommunitys.com.cy.entity.Role;
import com.cy.teducommunitys.com.cy.service.IAttentionService;
import com.cy.teducommunitys.com.cy.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * <p>
 * 关注表 前端控制器
 * </p>
 *
 * @author mdzz
 * @since 2019-07-19
 */
@RestController
@RequestMapping("/cy/attention")
public class AttentionController extends BaseController<Attention>{
    private IAttentionService svc;
    @Autowired
    public AttentionController(IAttentionService svc){
        super(svc);
        this.svc = svc;
    }

    @RequestMapping("findAllObjects")
    public JsonResult findAllObjects(Page page, Integer userId){
        HashMap<String,Object> map = new HashMap<>();
        map.put("userId",userId);
        return super.findAllObjects(page,map);
    }

    @RequestMapping("saveObject")
    public JsonResult saveObject(Attention entity){
        return super.saveObject(entity,entity.getUserId());
    }

    @RequestMapping("deleteObject")
    public JsonResult deleteObject(Integer userId){
        return super.deleteObject(userId);
    }

}

